package  
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Rectangle;
	/**
	 * ...
	 * @author Lorenzo Nuvoletta
	 */
	public class TestBounds extends Sprite 
	{
		private var spr:Sprite;		
		
		public function TestBounds() 
		{			
			spr = new Sprite();
			spr.graphics.beginFill(0xcc0000);
			spr.graphics.drawEllipse(-25, -50, 50, 100);
			//spr.graphics.drawCircle(0,0,50);
			spr.graphics.endFill();
			addChild(spr);
			
			spr.x +=100;
			spr.y += 100;
			
			addEventListener(Event.ENTER_FRAME, onFrame);
		}
		
		private function onFrame(e:Event):void {
			spr.rotation++;
			var rect:Rectangle = spr.getBounds(this.spr);
			drawRect(rect);
		}
		
		private function drawRect(rect:Rectangle):void {			
			this.graphics.clear();
			this.graphics.lineStyle(1);
			this.graphics.drawRect(rect.x, rect.y, rect.width, rect.height);
		}
		
	}

}